import 'package:chatbot/fenxiang_shuju.dart';
import 'package:chatbot/utils.dart';
import 'package:flutter/cupertino.dart';

class CunChuGuanLi {
  static String huoquBid() {
    return "com.easy.chatguard";
  }

  static String shouyeJueseTishi() {
    return BenDiCunchu.get("home_role_tips") ?? Utils.morenTishi;
  }

  static void shezhiShouYeTishi(String tips) {
    BenDiCunchu.save("home_role_tips", tips);
  }

  static String shouyeJueseMing() {
    return BenDiCunchu.get("home_role_name") ?? "对话";
  }

  static void shezhiShouyeJuese(String name) {
    BenDiCunchu.save("home_role_name", name);
  }

  static String huoquShouyeJuese() {
    return BenDiCunchu.get("home_role_prompt") ?? "";
  }

  static void shezhiTishiJue(String role) {
    BenDiCunchu.save("home_role_prompt", role);
  }

  static String? getUID() {
    return BenDiCunchu.get("uidV3");
  }

  static void putUID(String uid) {
    debugPrint("uid=${uid}");
    BenDiCunchu.save("uidV3", uid);
  }

  static String? getUUID() {
    return BenDiCunchu.get("uuid");
  }

  static void putUUID(String uuid) {
    debugPrint("uuid=${uuid}");
    BenDiCunchu.save("uuid", uuid);
  }

  static String dangqianYuyan() {
    return BenDiCunchu.get("localeId") ?? "zh-CN";
  }

  static void shezhiDangqianYUyan(String localeId) {
    debugPrint("localeId=$localeId");
    BenDiCunchu.save("localeId", localeId);
  }

  static bool isVip() {
    bool isVip = guoqishijian() > DateTime.now().millisecondsSinceEpoch;
    debugPrint("isVip=$isVip");
    return isVip;
    // return true;
  }

  static bool shagnxiawen() {
    return BenDiCunchu.get("needContext") ?? false;
  }

  static void shiFouShangxiawen(bool needContext) {
    BenDiCunchu.save("needContext", needContext);
  }

  static bool yunxuyuyin() {
    return BenDiCunchu.get("speech_allowV5") ?? false;
  }

  static void shezhiYuyinYunsu(bool allow) {
    BenDiCunchu.save("speech_allowV5", allow);
  }

  static bool shiFouKeyVisible() {
    return BenDiCunchu.get("keyboard_visible") ?? false;
  }

  static void shezhiKeyVisible(bool visible) {
    BenDiCunchu.save("keyboard_visible", visible);
  }

  static getVersion() {
    return "1.0";
  }

  static bool shifouzhuce() {
    return BenDiCunchu.get("register_uid") ?? false;
  }

  static void shezhizhuce() {
    BenDiCunchu.save("register_uid", true);
  }

  static int guoqishijian() {
    return BenDiCunchu.get("expire_date") ?? 0;
  }

  static void cunGuoqisj(int date) {
    debugPrint("expire date=$date");
    BenDiCunchu.save("expire_date", date);
  }

  static void cunDingyueJg(String price) {
    BenDiCunchu.save("price", price);
  }

  static String huoquDingyueJiage() {
    return BenDiCunchu.get("price") ?? "0";
  }

  static cunJueseJson(String json) async {
    debugPrint("putRoleJson=$json");
    await BenDiCunchu.save("role_jsonV2", json);
  }

  static String huoquJueseJson() {
    return BenDiCunchu.get("role_jsonV2") ?? "";
  }

  static cunChuangzuoJson(String json) async {
    debugPrint("putCreatorJson=$json");
    await BenDiCunchu.save("creator_jsonV3", json);
  }

  static String huoquChuangzuoJson() {
    return BenDiCunchu.get("creator_jsonV3") ?? "";
  }
}
